﻿using System;
using System.Windows.Forms;

namespace River.IntAI
{
    public class BaseForm : Form
    {
        public BaseForm()
        {
        }

        protected override void OnLoad(EventArgs e)
        {
            this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
        }

        public void ShowMainStatus(string msg)
        {
            MainStatusEvent?.Invoke(msg);
        }
        public static MainStatusArgs MainStatusEvent;
    }
    public delegate void MainStatusArgs(string msg);

    //参数类
    public class DeleArgs : EventArgs
    {
        public DeleArgs(object[] args)
        {
            Args = args;
        }
        public object[] Args { get; set; }
    }

    public static class FormUtils
    {
        public static void InvokeDele(this Control control, Action<DeleArgs> action, DeleArgs args)
        {
            if (control.InvokeRequired)
                control.Invoke(action, args);
            else
                action(args);
        }

        public static void InvokeDele(this Control control, Action action)
        {
            if (control.InvokeRequired)
                control.Invoke(action);
            else
                action();
        }
    }
}
